-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Diagnostics component #727
Conversation
the code looks good. Can you check whether there is something sensitive in the thread name when you insert a file? (any info about the target key) can you check that you don’t change the indentation? The current format isn’t ideal, but better strange but consistent indentation than inconsistent indentation. |
Some more comments over IRC:
|
From what I can see using the thread info there's no sensitive information but I'll look closely at the different places this is being used.
I corrected the code styles and imports, should be following the convention now 👍 Edit: There's this one maybe: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m sorry that my reviews always turn into these please-change-everything requests… 😕
src/freenet/node/diagnostics/diagnostics/threads/ThreadsDiagnostics.java
Outdated
Show resolved
Hide resolved
src/freenet/node/diagnostics/diagnostics/threads/ThreadsDiagnostics.java
Outdated
Show resolved
Hide resolved
src/freenet/node/diagnostics/diagnostics/threads/ThreadsDiagnostics.java
Outdated
Show resolved
Hide resolved
src/freenet/node/diagnostics/diagnostics/threads/ThreadsDiagnostics.java
Outdated
Show resolved
Hide resolved
src/freenet/node/diagnostics/diagnostics/threads/ThreadsDiagnostics.java
Outdated
Show resolved
Hide resolved
src/freenet/node/diagnostics/threads/DefaultThreadDiagnostics.java
Outdated
Show resolved
Hide resolved
src/freenet/node/diagnostics/threads/DefaultThreadDiagnostics.java
Outdated
Show resolved
Hide resolved
src/freenet/node/diagnostics/threads/DefaultThreadDiagnostics.java
Outdated
Show resolved
Hide resolved
src/freenet/node/diagnostics/threads/DefaultThreadDiagnostics.java
Outdated
Show resolved
Hide resolved
This is a useful feature! I'm wondering if the CPU time metrics could be misleading when combined with the pooled executor? If I understand correctly it changes jobs within a given thread, so could it report a high CPU utilization for a thread that just got done doing something intensive, and misleadingly attribute that to an idle thread or something that actually doesn't use much CPU? Would it be worth it to modify the pooled executor to set a zero point when switching jobs to avoid this? |
src/freenet/node/diagnostics/threads/DefaultThreadDiagnostics.java
Outdated
Show resolved
Hide resolved
src/freenet/node/diagnostics/threads/DefaultThreadDiagnostics.java
Outdated
Show resolved
Hide resolved
src/freenet/node/diagnostics/threads/DefaultThreadDiagnostics.java
Outdated
Show resolved
Hide resolved
src/freenet/node/diagnostics/threads/DefaultThreadDiagnostics.java
Outdated
Show resolved
Hide resolved
Few things missing:
|
I don’t think the effort would be worth it. If you split up a thread’s runtime into A (the previous job, large runtime) and B (current job, small runtime) then you still wouldn’t see where the larger amount of time has been spent; it would just be a little less misleading but that only until the next measurement is complete because by then either we get the real runtime for the job or the thread has already been replaced by something else. Plus, if a thread can have two jobs running in a measurement interval it can also have 1000 jobs running in a measurement interval and I don’t think anybody wants to keep track of that. :) We would have to modify both our own executor (which I think we should get rid off in favour of one of the JDK implementations) and the diagnostics for something that has questionable gain to begin with… |
Ooh, okay. Yep. Very good points. Never mind then.
…On Tue, May 4, 2021 at 12:57 AM, David Roden ***@***.***> wrote:
> Would it be worth it to modify the pooled executor to set a zero point when switching jobs to avoid this?
I don’t think the effort would be worth it. If you split up a thread’s runtime into A (the previous job, large runtime) and B (current job, small runtime) then you still wouldn’t see where the larger amount of time has been spent; it would just be a little less misleading but that only until the next measurement is complete because by then either we get the real runtime for the job or the thread has already been replaced by something else. Plus, if a thread can have two jobs running in a measurement interval it can also have 1000 jobs running in a measurement interval and I don’t think anybody wants to keep track of that. :)
We would have to modify both our own executor (which I think we should get rid off in favour of one of the JDK implementations) and the diagnostics for something that has questionable gain to begin with…
—
You are receiving this because you commented.
Reply to this email directly, [view it on GitHub](#727 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AABQZ3N3CJWQRAF7ZCWSY6TTL55FBANCNFSM42MCGUPQ).
|
Is it worth adding a notice to the UI about this limitation? It doesn't seem evident from the UI, and seems only especially meaningful if a given job regularly shows up with high CPU time. Maybe something like:
|
src/freenet/node/diagnostics/threads/DefaultThreadDiagnostics.java
Outdated
Show resolved
Hide resolved
src/freenet/node/diagnostics/threads/DefaultThreadDiagnostics.java
Outdated
Show resolved
Hide resolved
Good news! According to FProxyToadlet#1245 this already happens so we're good here. :) |
I think in terms of functionality all is done. I'll do some clean up on syntax though. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You know what? I think this is it. 🙂
Thank you for your efforts!
Looking at the frequency of name changes shows that the majority of threads do not report the name of the actual runnable. How viable would it be to reduce the collection timeframe? Would there be enough info in 100ms or in 30ms? |
Such slow intervals to be seems like a lot of work. Mostly because I imagine the user only watching at this a couple of seconds to figure out something and then leaving it alone. So a lot of wasted CPU cycles. Maybe this value can be configured, like turning this functionality on/off is now. |
desyncr ***@***.***> writes:
> Looking at the frequency of name changes shows that the majority of threads do not report the name of the actual runnable. How viable would it be to reduce the collection timeframe? Would there be enough info in 100ms or in 30ms?
Such slow intervals to be seems like a lot of work.
I meant milliseconds. Can we make it so short that only a fraction of
the threads switch runnables?
Best wishes,
Arne
--
Unpolitisch sein
heißt politisch sein
ohne es zu merken
|
I think you’re still trying to fix a problem that is an edge case. We can of course take another look at it when we see how it performs in the wild but for now I think both the current code and the default interval of 1s is fine. |
Could you check this patch and adjust the measurement period to minimize the switching threads?
I got a report with 90% of Threads changing names when checked like this. |
Does this prevent a name change between two measurements. If I understand it correctly, this gets the threads CPU-time and subtracts the previous CPU-time of the thread — whichever name it had then. If I do get this right, then the only way to make this exact would be to take a snapshot of the CPU-time for each name in a secondary structure (i.e. hashmap) and change the executor to record a delta everytime a name changes. The overhead of that could be significant, though, that’s why I’d rather opt to keep it simple and reduce the measuring time enough that name changes during measurement are rare. Maybe avoid wrong output by aggregating all the names the thread had during measurement (on every name change also add the new name to a list of names per thread). |
I see your point. I think if |
Applied the logic to keep track of CPU usage per job id (rather than thread id). Synchronizing and keeping a copy of the jobs name at the time of measurement. |
Yeah! Glad to see this merged! |
This PR updates the /diagnostics section (DiagnosticToadlet) to display thread information, including CPU usage, to the user. The intention is to show information to determine the cause of CPU usage (ex. plugins, Log, UPnP etc).